// space-buccaneer
//
// playstate.h
#ifndef __PLAYSTATE_H__
#define __PLAYSTATE_H__

// includes
#include <SFML/Graphics.hpp>
#include "gamestate.h"
#include <vector>
#include <list>

// start class CPlayState

class go : public sf::Sprite
{
public:
    sf::Sprite spr;
    float xu;
    float yu;
};


class CPlayState : public CGameState
{
public:

    void Init();
    void Cleanup();

    void Pause();
    void Resume();

    void HandleEvents(CGameEngine* game);
    void Update(CGameEngine* game);
    void Draw(CGameEngine* game);

    void FadeOut(CGameEngine* game);

    //bool CheckDraw(sf::Sprite, CGameEngine* game);
    bool CheckDraw(go*, CGameEngine*);

    static CPlayState* Instance()
    {
        return &m_PlayState;
    }

    sf::View view;
    float view_x;
    float view_y;
    float max_view_x;
    float max_view_y;

    sf::Clock clock_fps;
    float fps;
    float lastTime;
    float currentTime;

    float turn;
    float speed;
    sf::Clock clock;

    float vec_x, vec_y;
    float piover180;

    float scroll_x;
    float scroll_y;

    std::list<go*> go_list;
    std::list<go*>::iterator i_go;

    std::list<go*> stars_list;
    std::list<go*>::iterator i_stars;

protected:
    CPlayState() { }

private:
    static CPlayState m_PlayState;

    sf::Texture m_tex_methaneice;
    sf::Sprite m_spr_methaneice;
    sf::Texture m_tex_methanebarren;
    sf::Sprite m_spr_methanebarren;
    sf::Texture m_tex_barrencharred;
    sf::Sprite m_spr_barrencharred;
    sf::Texture m_tex_barrenicy;
    sf::Sprite m_spr_barrenicy;
    sf::Texture m_tex_barren;
    sf::Sprite m_spr_barren;
    sf::Texture m_tex_pirate1;
    sf::Sprite m_spr_pirate1;

    sf::Texture m_tex_w1x1;
    sf::Texture m_tex_w3x3;

    sf::Texture m_tex_end;
    sf::Sprite m_spr_end_top[500];
    sf::Sprite m_spr_end_bottom[500];
    sf::Sprite m_spr_end_left[500];
    sf::Sprite m_spr_end_right[500];

}; // end class CIntroState
#endif
